package singleton;

/**
 * @description:
 * @author: jhy
 * @time: 2021/4/22 22:22
 */

//使用枚举实现单例模式
public class EnumSingletonSafeTest {

    public static void main(String[] args) {
        EnumSingletonSafe.INSTANCE.test();
        EnumSingletonSafe.INSTANCE.test();
    }
}

enum EnumSingletonSafe {
    INSTANCE;
    public void test(){
        System.out.println("hi~" + INSTANCE.hashCode());
    }
}
